// Copyright 2018 Grass Valley, A Belden Brand

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at

//     http://www.apache.org/licenses/LICENSE-2.0

// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

//cWinErrorCodes.cpp

#include "StdAfx.h"

#pragma warning(disable: 4201)
#include ".\cwinerrorcodes.h"
#include "mycifs.h"
#include <winioctl.h>

cWinErrorCodes::tErrCodeMultiMap cWinErrorCodes::m_32toNTMap;
cWinErrorCodes::tErrCodeMap cWinErrorCodes::m_NTto32Map;

cWinErrorCodes::cWinErrorCodes(void)
{
  vfs::cLockGuard lg(&init);

  if (m_32toNTMap.empty())
  {
    //Mapping of error codes from http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q113996
    addCodes(STATUS_DATATYPE_MISALIGNMENT,            ERROR_NOACCESS);
    addCodes(STATUS_ACCESS_VIOLATION,                 ERROR_NOACCESS);
    addCodes(STATUS_DATATYPE_MISALIGNMENT_ERROR,      ERROR_NOACCESS);
    addCodes(STATUS_NOT_LOCKED,                       ERROR_NOT_LOCKED);
    addCodes(STATUS_NOT_MAPPED_VIEW,                  ERROR_INVALID_ADDRESS);
    addCodes(STATUS_MORE_PROCESSING_REQUIRED,         ERROR_MORE_DATA);
    addCodes(STATUS_STACK_OVERFLOW,                   ERROR_STACK_OVERFLOW);
    addCodes(STATUS_BAD_INITIAL_STACK,                ERROR_STACK_OVERFLOW);
    addCodes(STATUS_INVALID_VOLUME_LABEL,             ERROR_LABEL_TOO_LONG);
    addCodes(STATUS_SECTION_NOT_EXTENDED,             ERROR_OUTOFMEMORY);
    addCodes(STATUS_NOT_MAPPED_DATA,                  ERROR_INVALID_ADDRESS);
    addCodes(STATUS_NO_LDT,                           ERROR_INVALID_THREAD_ID);
    addCodes(STATUS_INFO_LENGTH_MISMATCH,             ERROR_BAD_LENGTH);
    addCodes(STATUS_SUSPEND_COUNT_EXCEEDED,           ERROR_SIGNAL_REFUSED);
    addCodes(STATUS_NOTIFY_ENUM_DIR,                  ERROR_NOTIFY_ENUM_DIR);
    addCodes(STATUS_REGISTRY_RECOVERED,               ERROR_REGISTRY_RECOVERED);
    addCodes(STATUS_REGISTRY_IO_FAILED,               ERROR_REGISTRY_IO_FAILED);
    addCodes(STATUS_NOT_REGISTRY_FILE,                ERROR_NOT_REGISTRY_FILE);
    addCodes(STATUS_KEY_DELETED,                      ERROR_KEY_DELETED);
    addCodes(STATUS_NO_LOG_SPACE,                     ERROR_NO_LOG_SPACE);
    addCodes(STATUS_KEY_HAS_CHILDREN,                 ERROR_KEY_HAS_CHILDREN);
    addCodes(STATUS_CHILD_MUST_BE_VOLATILE,           ERROR_CHILD_MUST_BE_VOLATILE);
    addCodes(STATUS_REGISTRY_CORRUPT,                 ERROR_BADDB);
    addCodes(STATUS_DLL_NOT_FOUND,                    ERROR_MOD_NOT_FOUND);
    addCodes(STATUS_DLL_INIT_FAILED,                  ERROR_DLL_INIT_FAILED);
    addCodes(STATUS_INVALID_IMPORT_OF_NON_DLL,        ERROR_INVALID_IMPORT_OF_NON_DLL);
    addCodes(STATUS_ORDINAL_NOT_FOUND,                ERROR_INVALID_ORDINAL);
    addCodes(STATUS_DRIVER_ORDINAL_NOT_FOUND,         ERROR_INVALID_ORDINAL);
    addCodes(STATUS_DRIVER_UNABLE_TO_LOAD,            ERROR_BAD_DRIVER);
    addCodes(STATUS_ENTRYPOINT_NOT_FOUND,             ERROR_PROC_NOT_FOUND);
    addCodes(STATUS_DRIVER_ENTRYPOINT_NOT_FOUND,      ERROR_PROC_NOT_FOUND);
    addCodes(STATUS_PENDING,                          ERROR_IO_PENDING);
    addCodes(STATUS_MORE_ENTRIES,                     ERROR_MORE_DATA);
    addCodes(STATUS_INTEGER_OVERFLOW,                 ERROR_ARITHMETIC_OVERFLOW);
    addCodes(STATUS_BUFFER_OVERFLOW,                  ERROR_MORE_DATA);
    addCodes(STATUS_NO_MORE_FILES,                    ERROR_NO_MORE_FILES);
    addCodes(STATUS_NO_MORE_EAS,                      ERROR_NO_MORE_FILES);
    addCodes(STATUS_NO_MORE_ENTRIES,                  ERROR_NO_MORE_FILES);
    addCodes(STATUS_GUIDS_EXHAUSTED,                  ERROR_NO_MORE_FILES);
    addCodes(STATUS_AGENTS_EXHAUSTED,                 ERROR_NO_MORE_FILES);
    addCodes(STATUS_NO_INHERITANCE,                   ERROR_NO_INHERITANCE);
    addCodes(STATUS_UNSUCCESSFUL,                     ERROR_GEN_FAILURE);
    addCodes(STATUS_TOO_MANY_LINKS,                   ERROR_TOO_MANY_LINKS);
    addCodes(STATUS_NOT_IMPLEMENTED,                  ERROR_INVALID_FUNCTION);
    addCodes(STATUS_ILLEGAL_FUNCTION,                 ERROR_INVALID_FUNCTION);
    addCodes(STATUS_IN_PAGE_ERROR,                    ERROR_SWAPERROR);
    addCodes(STATUS_PAGEFILE_QUOTA,                   ERROR_PAGEFILE_QUOTA);
    addCodes(STATUS_COMMITMENT_LIMIT,                 ERROR_COMMITMENT_LIMIT);
    addCodes(STATUS_INVALID_HANDLE,                   ERROR_INVALID_HANDLE);
    addCodes(STATUS_NOT_COMMITTED,                    ERROR_INVALID_ADDRESS);
    addCodes(STATUS_PARTIAL_COPY,                     ERROR_PARTIAL_COPY);
    addCodes(STATUS_LPC_REPLY_LOST,                   ERROR_INTERNAL_ERROR);
    addCodes(STATUS_INVALID_PARAMETER,                ERROR_INVALID_PARAMETER);
    addCodes(STATUS_RESOURCE_DATA_NOT_FOUND,          ERROR_RESOURCE_DATA_NOT_FOUND);
    addCodes(STATUS_RESOURCE_TYPE_NOT_FOUND,          ERROR_RESOURCE_TYPE_NOT_FOUND);
    addCodes(STATUS_RESOURCE_NAME_NOT_FOUND,          ERROR_RESOURCE_NAME_NOT_FOUND);
    addCodes(STATUS_RESOURCE_LANG_NOT_FOUND,          ERROR_RESOURCE_LANG_NOT_FOUND);
    addCodes(STATUS_INVALID_DEVICE_REQUEST,           ERROR_INVALID_FUNCTION);
    addCodes(STATUS_VOLUME_NOT_UPGRADED,              ERROR_INVALID_FUNCTION);
    addCodes(STATUS_END_OF_FILE,                      ERROR_HANDLE_EOF);
    addCodes(STATUS_FILE_FORCED_CLOSED,               ERROR_HANDLE_EOF);
    addCodes(STATUS_WRONG_VOLUME,                     ERROR_WRONG_DISK);
    addCodes(STATUS_NO_MEDIA,                         ERROR_NO_MEDIA_IN_DRIVE);
    addCodes(STATUS_NO_MEDIA_IN_DEVICE,               ERROR_NOT_READY);
    addCodes(STATUS_VOLUME_DISMOUNTED,                ERROR_NOT_READY);
    addCodes(STATUS_NONEXISTENT_SECTOR,               ERROR_SECTOR_NOT_FOUND);
    addCodes(STATUS_WORKING_SET_QUOTA,                ERROR_WORKING_SET_QUOTA);
    addCodes(STATUS_NO_MEMORY,                        ERROR_NOT_ENOUGH_MEMORY);
    addCodes(STATUS_CONFLICTING_ADDRESSES,            ERROR_INVALID_ADDRESS);
    addCodes(STATUS_INVALID_SYSTEM_SERVICE,           ERROR_INVALID_FUNCTION);
    addCodes(STATUS_ACCESS_DENIED,                    ERROR_ACCESS_DENIED);
    addCodes(STATUS_INVALID_COMPUTER_NAME,            ERROR_INVALID_COMPUTERNAME);
    addCodes(STATUS_NO_SUCH_PRIVILEGE,                ERROR_NO_SUCH_PRIVILEGE);
    addCodes(STATUS_PRIVILEGE_NOT_HELD,               ERROR_PRIVILEGE_NOT_HELD);
    addCodes(STATUS_CANNOT_IMPERSONATE,               ERROR_CANNOT_IMPERSONATE);
    addCodes(STATUS_LOGON_FAILURE,                    ERROR_LOGON_FAILURE);
    addCodes(STATUS_MUTUAL_AUTHENTICATION_FAILED,     ERROR_MUTUAL_AUTH_FAILED);
    addCodes(STATUS_TIME_DIFFERENCE_AT_DC,            ERROR_TIME_SKEW);
    addCodes(STATUS_PKINIT_FAILURE,                   ERROR_PKINIT_FAILURE);
    addCodes(STATUS_SMARTCARD_SUBSYSTEM_FAILURE,      ERROR_SMARTCARD_SUBSYSTEM_FAILURE);
    addCodes(STATUS_DOWNGRADE_DETECTED,               ERROR_DOWNGRADE_DETECTED);
    addCodes(STATUS_SMARTCARD_CERT_REVOKED,           SEC_E_SMARTCARD_CERT_REVOKED);
    addCodes(STATUS_ISSUING_CA_UNTRUSTED,             SEC_E_ISSUING_CA_UNTRUSTED);
    addCodes(STATUS_REVOCATION_OFFLINE_C,             SEC_E_REVOCATION_OFFLINE_C);
    addCodes(STATUS_PKINIT_CLIENT_FAILURE,            SEC_E_PKINIT_CLIENT_FAILURE);
    addCodes(STATUS_SMARTCARD_CERT_EXPIRED,           SEC_E_SMARTCARD_CERT_EXPIRED);
    addCodes(STATUS_NO_KERB_KEY,                      SEC_E_NO_KERB_KEY);
    addCodes(STATUS_CURRENT_DOMAIN_NOT_ALLOWED,       ERROR_CURRENT_DOMAIN_NOT_ALLOWED);
    addCodes(STATUS_SMARTCARD_WRONG_PIN,              SCARD_W_WRONG_CHV);
    addCodes(STATUS_SMARTCARD_CARD_BLOCKED,           SCARD_W_CHV_BLOCKED);
    addCodes(STATUS_SMARTCARD_CARD_NOT_AUTHENTICATED, SCARD_W_CARD_NOT_AUTHENTICATED);
    addCodes(STATUS_SMARTCARD_NO_CARD,                SCARD_E_NO_SMARTCARD);
    addCodes(STATUS_SMARTCARD_NO_KEY_CONTAINER,       NTE_NO_KEY);
    addCodes(STATUS_SMARTCARD_NO_CERTIFICATE,         SCARD_E_NO_SUCH_CERTIFICATE);
    addCodes(STATUS_SMARTCARD_NO_KEYSET,              NTE_BAD_KEYSET);
    addCodes(STATUS_SMARTCARD_IO_ERROR,               SCARD_E_COMM_DATA_LOST);
    addCodes(STATUS_ACCOUNT_RESTRICTION,              ERROR_ACCOUNT_RESTRICTION);
    addCodes(STATUS_INVALID_LOGON_HOURS,              ERROR_INVALID_LOGON_HOURS);
    addCodes(STATUS_INVALID_WORKSTATION,              ERROR_INVALID_WORKSTATION);
    addCodes(STATUS_BUFFER_TOO_SMALL,                 ERROR_INSUFFICIENT_BUFFER);
    addCodes(STATUS_UNABLE_TO_DECOMMIT_VM,            ERROR_INVALID_ADDRESS);
    addCodes(STATUS_DISK_CORRUPT_ERROR,               ERROR_DISK_CORRUPT);
    addCodes(STATUS_FT_MISSING_MEMBER,                ERROR_IO_DEVICE);
    addCodes(STATUS_FT_ORPHANING,                     ERROR_IO_DEVICE);
    addCodes(STATUS_VARIABLE_NOT_FOUND,               ERROR_ENVVAR_NOT_FOUND);
    addCodes(STATUS_OBJECT_NAME_INVALID,              ERROR_INVALID_NAME);
    addCodes(STATUS_OBJECT_NAME_NOT_FOUND,            ERROR_FILE_NOT_FOUND);
    addCodes(STATUS_OBJECT_NAME_COLLISION,            ERROR_ALREADY_EXISTS);
    addCodes(STATUS_OBJECT_PATH_INVALID,              ERROR_BAD_PATHNAME);
    addCodes(STATUS_OBJECT_PATH_NOT_FOUND,            ERROR_PATH_NOT_FOUND);
    addCodes(STATUS_DFS_EXIT_PATH_FOUND,              ERROR_PATH_NOT_FOUND);
    addCodes(STATUS_DFS_UNAVAILABLE,                  ERROR_CONNECTION_UNAVAIL);
    addCodes(STATUS_OBJECT_PATH_SYNTAX_BAD,           ERROR_BAD_PATHNAME);
    addCodes(STATUS_NAME_TOO_LONG,                    ERROR_FILENAME_EXCED_RANGE);
    addCodes(STATUS_DATA_OVERRUN,                     ERROR_IO_DEVICE);
    addCodes(STATUS_DATA_LATE_ERROR,                  ERROR_IO_DEVICE);
    addCodes(STATUS_DATA_ERROR,                       ERROR_CRC);
    addCodes(STATUS_CRC_ERROR,                        ERROR_CRC);
    addCodes(STATUS_SHARING_VIOLATION,                ERROR_SHARING_VIOLATION);
    addCodes(STATUS_QUOTA_EXCEEDED,                   ERROR_NOT_ENOUGH_QUOTA);
    addCodes(STATUS_MUTANT_NOT_OWNED,                 ERROR_NOT_OWNER);
    addCodes(STATUS_SEMAPHORE_LIMIT_EXCEEDED,         ERROR_TOO_MANY_POSTS);
    addCodes(STATUS_DISK_FULL,                        ERROR_DISK_FULL);
    addCodes(STATUS_LOCK_NOT_GRANTED,                 ERROR_LOCK_VIOLATION);
    addCodes(STATUS_FILE_LOCK_CONFLICT,               ERROR_LOCK_VIOLATION);
    addCodes(STATUS_NOT_A_DIRECTORY,                  ERROR_DIRECTORY);
    addCodes(STATUS_CANNOT_MAKE,                      ERROR_CANNOT_MAKE);
    addCodes(STATUS_UNKNOWN_REVISION,                 ERROR_UNKNOWN_REVISION);
    addCodes(STATUS_REVISION_MISMATCH,                ERROR_REVISION_MISMATCH);
    addCodes(STATUS_INVALID_OWNER,                    ERROR_INVALID_OWNER);
    addCodes(STATUS_INVALID_PRIMARY_GROUP,            ERROR_INVALID_PRIMARY_GROUP);
    addCodes(STATUS_NO_IMPERSONATION_TOKEN,           ERROR_NO_IMPERSONATION_TOKEN);
    addCodes(STATUS_CANT_DISABLE_MANDATORY,           ERROR_CANT_DISABLE_MANDATORY);
    addCodes(STATUS_NO_LOGON_SERVERS,                 ERROR_NO_LOGON_SERVERS);
    addCodes(STATUS_DOMAIN_CONTROLLER_NOT_FOUND,      ERROR_DOMAIN_CONTROLLER_NOT_FOUND);
    addCodes(STATUS_NO_SUCH_LOGON_SESSION,            ERROR_NO_SUCH_LOGON_SESSION);
    addCodes(STATUS_NO_SUCH_LOGON_SESSION,            ERROR_NO_SUCH_LOGON_SESSION);
    addCodes(STATUS_INVALID_ACCOUNT_NAME,             ERROR_INVALID_ACCOUNT_NAME);
    addCodes(STATUS_USER_EXISTS,                      ERROR_USER_EXISTS);
    addCodes(STATUS_NO_SUCH_USER,                     ERROR_NO_SUCH_USER);
    addCodes(STATUS_GROUP_EXISTS,                     ERROR_GROUP_EXISTS);
    addCodes(STATUS_NO_SUCH_GROUP,                    ERROR_NO_SUCH_GROUP);
    addCodes(STATUS_SPECIAL_GROUP,                    ERROR_SPECIAL_GROUP);
    addCodes(STATUS_MEMBER_IN_GROUP,                  ERROR_MEMBER_IN_GROUP);
    addCodes(STATUS_MEMBER_NOT_IN_GROUP,              ERROR_MEMBER_NOT_IN_GROUP);
    addCodes(STATUS_LAST_ADMIN,                       ERROR_LAST_ADMIN);
    addCodes(STATUS_WRONG_PASSWORD,                   ERROR_INVALID_PASSWORD);
    addCodes(STATUS_WRONG_PASSWORD_CORE,              ERROR_INVALID_PASSWORD);
    addCodes(STATUS_ILL_FORMED_PASSWORD,              ERROR_ILL_FORMED_PASSWORD);
    addCodes(STATUS_PASSWORD_RESTRICTION,             ERROR_PASSWORD_RESTRICTION);
    addCodes(STATUS_PASSWORD_EXPIRED,                 ERROR_PASSWORD_EXPIRED);
    addCodes(STATUS_PASSWORD_MUST_CHANGE,             ERROR_PASSWORD_MUST_CHANGE);
    addCodes(STATUS_ACCOUNT_DISABLED,                 ERROR_ACCOUNT_DISABLED);
    addCodes(STATUS_ACCOUNT_LOCKED_OUT,               ERROR_ACCOUNT_LOCKED_OUT);
    addCodes(STATUS_NONE_MAPPED,                      ERROR_NONE_MAPPED);
    addCodes(STATUS_TOO_MANY_LUIDS_REQUESTED,         ERROR_TOO_MANY_LUIDS_REQUESTED);
    addCodes(STATUS_LUIDS_EXHAUSTED,                  ERROR_LUIDS_EXHAUSTED);
    addCodes(STATUS_INVALID_SUB_AUTHORITY,            ERROR_INVALID_SUB_AUTHORITY);
    addCodes(STATUS_INVALID_ACL,                      ERROR_INVALID_ACL);
    addCodes(STATUS_INVALID_SID,                      ERROR_INVALID_SID);
    addCodes(STATUS_INVALID_SECURITY_DESCR,           ERROR_INVALID_SECURITY_DESCR);
    addCodes(STATUS_PROCEDURE_NOT_FOUND,              ERROR_PROC_NOT_FOUND);
    addCodes(STATUS_BAD_INITIAL_PC,                   ERROR_BAD_EXE_FORMAT);
    addCodes(STATUS_INVALID_FILE_FOR_SECTION,         ERROR_BAD_EXE_FORMAT);
    addCodes(STATUS_INVALID_IMAGE_FORMAT,             ERROR_BAD_EXE_FORMAT);
    addCodes(STATUS_IMAGE_MP_UP_MISMATCH,             ERROR_BAD_EXE_FORMAT);
    addCodes(STATUS_INVALID_IMAGE_NOT_MZ,             ERROR_BAD_EXE_FORMAT);
    addCodes(STATUS_IMAGE_CHECKSUM_MISMATCH,          ERROR_BAD_EXE_FORMAT);
    addCodes(STATUS_INVALID_IMAGE_PROTECT,            ERROR_BAD_EXE_FORMAT);
    addCodes(STATUS_INVALID_IMAGE_LE_FORMAT,          ERROR_BAD_EXE_FORMAT);
    addCodes(STATUS_INVALID_IMAGE_NE_FORMAT,          ERROR_BAD_EXE_FORMAT);
    addCodes(STATUS_INVALID_IMAGE_WIN_16,             ERROR_BAD_EXE_FORMAT);
    addCodes(STATUS_INVALID_IMAGE_WIN_32,             ERROR_BAD_EXE_FORMAT);
    addCodes(STATUS_INVALID_IMAGE_WIN_64,             ERROR_BAD_EXE_FORMAT);
    addCodes(STATUS_NO_TOKEN,                         ERROR_NO_TOKEN);
    addCodes(STATUS_RANGE_NOT_LOCKED,                 ERROR_NOT_LOCKED);
    addCodes(STATUS_SERVER_DISABLED,                  ERROR_SERVER_DISABLED);
    addCodes(STATUS_SERVER_NOT_DISABLED,              ERROR_SERVER_NOT_DISABLED);
    addCodes(STATUS_INVALID_ID_AUTHORITY,             ERROR_INVALID_ID_AUTHORITY);
    addCodes(STATUS_ALLOTTED_SPACE_EXCEEDED,          ERROR_ALLOTTED_SPACE_EXCEEDED);
    addCodes(STATUS_TOO_MANY_PAGING_FILES,            ERROR_NOT_ENOUGH_MEMORY);
    addCodes(STATUS_INSUFFICIENT_RESOURCES,           ERROR_NO_SYSTEM_RESOURCES);
    addCodes(STATUS_INSUFF_SERVER_RESOURCES,          ERROR_NOT_ENOUGH_SERVER_MEMORY);
    addCodes(STATUS_FILE_INVALID,                     ERROR_FILE_INVALID);
    addCodes(STATUS_MAPPED_FILE_SIZE_ZERO,            ERROR_FILE_INVALID);
    addCodes(STATUS_DEVICE_PAPER_EMPTY,               ERROR_OUT_OF_PAPER);
    addCodes(STATUS_DEVICE_POWERED_OFF,               ERROR_NOT_READY);
    addCodes(STATUS_DEVICE_OFF_LINE,                  ERROR_NOT_READY);
    addCodes(STATUS_DEVICE_DATA_ERROR,                ERROR_CRC);
    addCodes(STATUS_DEVICE_NOT_READY,                 ERROR_NOT_READY);
    addCodes(STATUS_DEVICE_NOT_CONNECTED,             ERROR_DEVICE_NOT_CONNECTED);
    addCodes(STATUS_DEVICE_POWER_FAILURE,             ERROR_NOT_READY);
    addCodes(STATUS_NOT_FOUND,                        ERROR_NOT_FOUND);
    addCodes(STATUS_NO_MATCH,                         ERROR_NO_MATCH);
    addCodes(STATUS_PROPSET_NOT_FOUND,                ERROR_SET_NOT_FOUND);
    addCodes(STATUS_DEVICE_BUSY,                      ERROR_BUSY);
    addCodes(STATUS_FREE_VM_NOT_AT_BASE,              ERROR_INVALID_ADDRESS);
    addCodes(STATUS_MEMORY_NOT_ALLOCATED,             ERROR_INVALID_ADDRESS);
    addCodes(STATUS_NOT_SAME_DEVICE,                  ERROR_NOT_SAME_DEVICE);
    addCodes(STATUS_NOT_SUPPORTED,                    ERROR_NOT_SUPPORTED);
    addCodes(STATUS_REMOTE_NOT_LISTENING,             ERROR_REM_NOT_LIST);
    addCodes(STATUS_DUPLICATE_NAME,                   ERROR_DUP_NAME);
    addCodes(STATUS_BAD_NETWORK_PATH,                 ERROR_BAD_NETPATH);
    addCodes(STATUS_NETWORK_BUSY,                     ERROR_NETWORK_BUSY);
    addCodes(STATUS_ONLY_IF_CONNECTED,                ERROR_ONLY_IF_CONNECTED);
    addCodes(STATUS_DEVICE_DOES_NOT_EXIST,            ERROR_DEV_NOT_EXIST);
    addCodes(STATUS_TOO_MANY_COMMANDS,                ERROR_TOO_MANY_CMDS);
    addCodes(STATUS_ADAPTER_HARDWARE_ERROR,           ERROR_ADAP_HDW_ERR);
    addCodes(STATUS_REDIRECTOR_NOT_STARTED,           ERROR_PATH_NOT_FOUND);
    addCodes(STATUS_INVALID_EA_NAME,                  ERROR_INVALID_EA_NAME);
    addCodes(STATUS_EA_LIST_INCONSISTENT,             ERROR_EA_LIST_INCONSISTENT);
    addCodes(STATUS_EA_TOO_LARGE,                     ERROR_EA_LIST_INCONSISTENT);
    addCodes(STATUS_INVALID_EA_FLAG,                  ERROR_EA_LIST_INCONSISTENT);
    addCodes(STATUS_EAS_NOT_SUPPORTED,                ERROR_EAS_NOT_SUPPORTED);
    addCodes(STATUS_FILE_CORRUPT_ERROR,               ERROR_FILE_CORRUPT);
    addCodes(STATUS_EA_CORRUPT_ERROR,                 ERROR_FILE_CORRUPT);
    addCodes(STATUS_NONEXISTENT_EA_ENTRY,             ERROR_FILE_CORRUPT);
    addCodes(STATUS_NO_EAS_ON_FILE,                   ERROR_FILE_CORRUPT);
    addCodes(STATUS_NOT_A_REPARSE_POINT,              ERROR_NOT_A_REPARSE_POINT);
    addCodes(STATUS_IO_REPARSE_TAG_INVALID,           ERROR_REPARSE_TAG_INVALID);
    addCodes(STATUS_IO_REPARSE_TAG_MISMATCH,          ERROR_REPARSE_TAG_MISMATCH);
    addCodes(STATUS_IO_REPARSE_TAG_NOT_HANDLED,       ERROR_CANT_ACCESS_FILE);
    addCodes(STATUS_REPARSE_POINT_NOT_RESOLVED,       ERROR_CANT_RESOLVE_FILENAME);
    addCodes(STATUS_DIRECTORY_IS_A_REPARSE_POINT,     ERROR_BAD_PATHNAME);
    addCodes(STATUS_REPARSE_ATTRIBUTE_CONFLICT,       ERROR_REPARSE_ATTRIBUTE_CONFLICT);
    addCodes(STATUS_IO_REPARSE_DATA_INVALID,          ERROR_INVALID_REPARSE_DATA);
    addCodes(STATUS_FILE_IS_OFFLINE,                  ERROR_FILE_OFFLINE);
    addCodes(STATUS_REMOTE_STORAGE_NOT_ACTIVE,        ERROR_REMOTE_STORAGE_NOT_ACTIVE);
    addCodes(STATUS_REMOTE_STORAGE_MEDIA_ERROR,       ERROR_REMOTE_STORAGE_MEDIA_ERROR);
    addCodes(STATUS_NO_TRACKING_SERVICE,              ERROR_NO_TRACKING_SERVICE);
    addCodes(STATUS_JOURNAL_DELETE_IN_PROGRESS,       ERROR_JOURNAL_DELETE_IN_PROGRESS);
    addCodes(STATUS_JOURNAL_NOT_ACTIVE,               ERROR_JOURNAL_NOT_ACTIVE);
    addCodes(STATUS_JOURNAL_ENTRY_DELETED,            ERROR_JOURNAL_ENTRY_DELETED);
    addCodes(STATUS_INVALID_NETWORK_RESPONSE,         ERROR_BAD_NET_RESP);
    addCodes(STATUS_USER_SESSION_DELETED,             ERROR_UNEXP_NET_ERR);
    addCodes(STATUS_UNEXPECTED_NETWORK_ERROR,         ERROR_UNEXP_NET_ERR);
    addCodes(STATUS_USER_SESSION_DELETED,             ERROR_UNEXP_NET_ERR);
    addCodes(STATUS_BAD_REMOTE_ADAPTER,               ERROR_BAD_REM_ADAP);
    addCodes(STATUS_PRINT_QUEUE_FULL,                 ERROR_PRINTQ_FULL);
    addCodes(STATUS_NO_SPOOL_SPACE,                   ERROR_NO_SPOOL_SPACE);
    addCodes(STATUS_PRINT_CANCELLED,                  ERROR_PRINT_CANCELLED);
    addCodes(STATUS_NETWORK_NAME_DELETED,             ERROR_NETNAME_DELETED);
    addCodes(STATUS_NETWORK_ACCESS_DENIED,            ERROR_NETWORK_ACCESS_DENIED);
    addCodes(STATUS_BAD_DEVICE_TYPE,                  ERROR_BAD_DEV_TYPE);
    addCodes(STATUS_BAD_NETWORK_NAME,                 ERROR_BAD_NET_NAME);
    addCodes(STATUS_TOO_MANY_NAMES,                   ERROR_TOO_MANY_NAMES);
    addCodes(STATUS_TOO_MANY_GUIDS_REQUESTED,         ERROR_TOO_MANY_NAMES);
    addCodes(STATUS_TOO_MANY_ADDRESSES,               ERROR_TOO_MANY_NAMES);
    addCodes(STATUS_TOO_MANY_NODES,                   ERROR_TOO_MANY_NAMES);
    addCodes(STATUS_TOO_MANY_SESSIONS,                ERROR_TOO_MANY_SESS);
    addCodes(STATUS_SHARING_PAUSED,                   ERROR_SHARING_PAUSED);
    addCodes(STATUS_REQUEST_NOT_ACCEPTED,             ERROR_REQ_NOT_ACCEP);
    addCodes(STATUS_REDIRECTOR_PAUSED,                ERROR_REDIR_PAUSED);
    addCodes(STATUS_NET_WRITE_FAULT,                  ERROR_NET_WRITE_FAULT);
    addCodes(STATUS_VIRTUAL_CIRCUIT_CLOSED,           ERROR_VC_DISCONNECTED);
    addCodes(STATUS_INVALID_PIPE_STATE,               ERROR_BAD_PIPE);
    addCodes(STATUS_INVALID_READ_MODE,                ERROR_BAD_PIPE);
    addCodes(STATUS_PIPE_CLOSING,                     ERROR_NO_DATA);
    addCodes(STATUS_PIPE_EMPTY,                       ERROR_NO_DATA);
    addCodes(STATUS_PIPE_CONNECTED,                   ERROR_PIPE_CONNECTED);
    addCodes(STATUS_PIPE_DISCONNECTED,                ERROR_PIPE_NOT_CONNECTED);
    addCodes(STATUS_PIPE_LISTENING,                   ERROR_PIPE_LISTENING);
    addCodes(STATUS_PIPE_NOT_AVAILABLE,               ERROR_PIPE_BUSY);
    addCodes(STATUS_INSTANCE_NOT_AVAILABLE,           ERROR_PIPE_BUSY);
    addCodes(STATUS_PIPE_BUSY,                        ERROR_PIPE_BUSY);
    addCodes(STATUS_PIPE_BROKEN,                      ERROR_BROKEN_PIPE);
    addCodes(STATUS_DIRECTORY_NOT_EMPTY,              ERROR_DIR_NOT_EMPTY);
    addCodes(STATUS_TOO_MANY_OPENED_FILES,            ERROR_TOO_MANY_OPEN_FILES);
    addCodes(STATUS_IO_TIMEOUT,                       ERROR_SEM_TIMEOUT);
    addCodes(STATUS_CANCELLED,                        ERROR_OPERATION_ABORTED);
    addCodes(STATUS_UNRECOGNIZED_MEDIA,               ERROR_UNRECOGNIZED_MEDIA);
    addCodes(STATUS_INVALID_LEVEL,                    ERROR_INVALID_LEVEL);
    addCodes(STATUS_UNRECOGNIZED_VOLUME,              ERROR_UNRECOGNIZED_VOLUME);
    addCodes(STATUS_MEDIA_WRITE_PROTECTED,            ERROR_WRITE_PROTECT);
    addCodes(STATUS_TOO_LATE,                         ERROR_WRITE_PROTECT);
    addCodes(STATUS_SUCCESS,                          NO_ERROR);
    addCodes(STATUS_FULLSCREEN_MODE,                  ERROR_FULLSCREEN_MODE);
    addCodes(STATUS_END_OF_MEDIA,                     ERROR_END_OF_MEDIA);
    addCodes(STATUS_EOM_OVERFLOW,                     ERROR_EOM_OVERFLOW);
    addCodes(STATUS_BEGINNING_OF_MEDIA,               ERROR_BEGINNING_OF_MEDIA);
    addCodes(STATUS_MEDIA_CHANGED,                    ERROR_MEDIA_CHANGED);
    addCodes(STATUS_BUS_RESET,                        ERROR_BUS_RESET);
    addCodes(STATUS_FILEMARK_DETECTED,                ERROR_FILEMARK_DETECTED);
    addCodes(STATUS_SETMARK_DETECTED,                 ERROR_SETMARK_DETECTED);
    addCodes(STATUS_NO_DATA_DETECTED,                 ERROR_NO_DATA_DETECTED);
    addCodes(STATUS_PARTITION_FAILURE,                ERROR_PARTITION_FAILURE);
    addCodes(STATUS_INVALID_BLOCK_LENGTH,             ERROR_INVALID_BLOCK_LENGTH);
    addCodes(STATUS_DEVICE_NOT_PARTITIONED,           ERROR_DEVICE_NOT_PARTITIONED);
    addCodes(STATUS_UNABLE_TO_LOCK_MEDIA,             ERROR_UNABLE_TO_LOCK_MEDIA);
    addCodes(STATUS_UNABLE_TO_UNLOAD_MEDIA,           ERROR_UNABLE_TO_UNLOAD_MEDIA);
    addCodes(STATUS_UNMAPPABLE_CHARACTER,             ERROR_NO_UNICODE_TRANSLATION);
    addCodes(STATUS_NOT_ALL_ASSIGNED,                 ERROR_NOT_ALL_ASSIGNED);
    addCodes(STATUS_SOME_NOT_MAPPED,                  ERROR_SOME_NOT_MAPPED);
    addCodes(STATUS_NO_QUOTAS_FOR_ACCOUNT,            ERROR_NO_QUOTAS_FOR_ACCOUNT);
    addCodes(STATUS_LOCAL_USER_SESSION_KEY,           ERROR_LOCAL_USER_SESSION_KEY);
    addCodes(STATUS_NULL_LM_PASSWORD,                 ERROR_NULL_LM_PASSWORD);
    addCodes(STATUS_BAD_INHERITANCE_ACL,              ERROR_BAD_INHERITANCE_ACL);
    addCodes(STATUS_INVALID_GROUP_ATTRIBUTES,         ERROR_INVALID_GROUP_ATTRIBUTES);
    addCodes(STATUS_BAD_IMPERSONATION_LEVEL,          ERROR_BAD_IMPERSONATION_LEVEL);
    addCodes(STATUS_CANT_OPEN_ANONYMOUS,              ERROR_CANT_OPEN_ANONYMOUS);
    addCodes(STATUS_BAD_VALIDATION_CLASS,             ERROR_BAD_VALIDATION_CLASS);
    addCodes(STATUS_BAD_TOKEN_TYPE,                   ERROR_BAD_TOKEN_TYPE);
    //addCodes(STATUS_BAD_MASTER_BOOT_RECORD,           ERROR_INVALID_PARAMETER);
    addCodes(STATUS_NO_SECURITY_ON_OBJECT,            ERROR_NO_SECURITY_ON_OBJECT);
    addCodes(STATUS_CANT_ACCESS_DOMAIN_INFO,          ERROR_CANT_ACCESS_DOMAIN_INFO);
    addCodes(STATUS_INVALID_SERVER_STATE,             ERROR_INVALID_SERVER_STATE);
    addCodes(STATUS_INVALID_DOMAIN_STATE,             ERROR_INVALID_DOMAIN_STATE);
    addCodes(STATUS_INVALID_DOMAIN_ROLE,              ERROR_INVALID_DOMAIN_ROLE);
    addCodes(STATUS_NO_SUCH_DOMAIN,                   ERROR_NO_SUCH_DOMAIN);
    addCodes(STATUS_DOMAIN_EXISTS,                    ERROR_DOMAIN_EXISTS);
    addCodes(STATUS_DOMAIN_LIMIT_EXCEEDED,            ERROR_DOMAIN_LIMIT_EXCEEDED);
    addCodes(STATUS_OPLOCK_NOT_GRANTED,               ERROR_OPLOCK_NOT_GRANTED);
    addCodes(STATUS_INVALID_OPLOCK_PROTOCOL,          ERROR_INVALID_OPLOCK_PROTOCOL);
    addCodes(STATUS_INTERNAL_DB_CORRUPTION,           ERROR_INTERNAL_DB_CORRUPTION);
    addCodes(STATUS_INTERNAL_ERROR,                   ERROR_INTERNAL_ERROR);
    addCodes(STATUS_GENERIC_NOT_MAPPED,               ERROR_GENERIC_NOT_MAPPED);
    addCodes(STATUS_BAD_DESCRIPTOR_FORMAT,            ERROR_BAD_DESCRIPTOR_FORMAT);
    addCodes(STATUS_NOT_LOGON_PROCESS,                ERROR_NOT_LOGON_PROCESS);
    addCodes(STATUS_LOGON_SESSION_EXISTS,             ERROR_LOGON_SESSION_EXISTS);
    addCodes(STATUS_NO_SUCH_PACKAGE,                  ERROR_NO_SUCH_PACKAGE);
    addCodes(STATUS_BAD_LOGON_SESSION_STATE,          ERROR_BAD_LOGON_SESSION_STATE);
    addCodes(STATUS_LOGON_SESSION_COLLISION,          ERROR_LOGON_SESSION_COLLISION);
    addCodes(STATUS_INVALID_LOGON_TYPE,               ERROR_INVALID_LOGON_TYPE);
    addCodes(STATUS_RXACT_INVALID_STATE,              ERROR_RXACT_INVALID_STATE);
    addCodes(STATUS_RXACT_COMMIT_FAILURE,             ERROR_RXACT_COMMIT_FAILURE);
    addCodes(STATUS_SPECIAL_ACCOUNT,                  ERROR_SPECIAL_ACCOUNT);
    addCodes(STATUS_SPECIAL_USER,                     ERROR_SPECIAL_USER);
    addCodes(STATUS_MEMBERS_PRIMARY_GROUP,            ERROR_MEMBERS_PRIMARY_GROUP);
    addCodes(STATUS_TOKEN_ALREADY_IN_USE,             ERROR_TOKEN_ALREADY_IN_USE);
    addCodes(STATUS_NO_SUCH_ALIAS,                    ERROR_NO_SUCH_ALIAS);
    addCodes(STATUS_MEMBER_NOT_IN_ALIAS,              ERROR_MEMBER_NOT_IN_ALIAS);
    addCodes(STATUS_MEMBER_IN_ALIAS,                  ERROR_MEMBER_IN_ALIAS);
    addCodes(STATUS_ALIAS_EXISTS,                     ERROR_ALIAS_EXISTS);
    addCodes(STATUS_LOGON_NOT_GRANTED,                ERROR_LOGON_NOT_GRANTED);
    addCodes(STATUS_TOO_MANY_SECRETS,                 ERROR_TOO_MANY_SECRETS);
    addCodes(STATUS_SECRET_TOO_LONG,                  ERROR_SECRET_TOO_LONG);
    addCodes(STATUS_INTERNAL_DB_ERROR,                ERROR_INTERNAL_DB_ERROR);
    addCodes(STATUS_TOO_MANY_CONTEXT_IDS,             ERROR_TOO_MANY_CONTEXT_IDS);
    addCodes(STATUS_LOGON_TYPE_NOT_GRANTED,           ERROR_LOGON_TYPE_NOT_GRANTED);
    addCodes(STATUS_NT_CROSS_ENCRYPTION_REQUIRED,     ERROR_NT_CROSS_ENCRYPTION_REQUIRED);
    addCodes(STATUS_NO_SUCH_MEMBER,                   ERROR_NO_SUCH_MEMBER);
    addCodes(STATUS_INVALID_MEMBER,                   ERROR_INVALID_MEMBER);
    addCodes(STATUS_TOO_MANY_SIDS,                    ERROR_TOO_MANY_SIDS);
    addCodes(STATUS_LM_CROSS_ENCRYPTION_REQUIRED,     ERROR_LM_CROSS_ENCRYPTION_REQUIRED);
    addCodes(STATUS_MESSAGE_NOT_FOUND,                ERROR_MR_MID_NOT_FOUND);
    addCodes(STATUS_LOCAL_DISCONNECT,                 ERROR_NETNAME_DELETED);
    addCodes(STATUS_REMOTE_DISCONNECT,                ERROR_NETNAME_DELETED);
    addCodes(STATUS_REMOTE_RESOURCES,                 ERROR_REM_NOT_LIST);
    addCodes(STATUS_LINK_FAILED,                      ERROR_UNEXP_NET_ERR);
    addCodes(STATUS_LINK_TIMEOUT,                     ERROR_UNEXP_NET_ERR);
    addCodes(STATUS_INVALID_CONNECTION,               ERROR_UNEXP_NET_ERR);
    addCodes(STATUS_INVALID_ADDRESS,                  ERROR_UNEXP_NET_ERR);
    addCodes(STATUS_IO_DEVICE_ERROR,                  ERROR_IO_DEVICE);
    addCodes(STATUS_DEVICE_PROTOCOL_ERROR,            ERROR_IO_DEVICE);
    addCodes(STATUS_DRIVER_INTERNAL_ERROR,            ERROR_IO_DEVICE);
    addCodes(STATUS_INVALID_DEVICE_STATE,             ERROR_BAD_COMMAND);
    addCodes(STATUS_SOURCE_ELEMENT_EMPTY,             ERROR_SOURCE_ELEMENT_EMPTY);
    addCodes(STATUS_DESTINATION_ELEMENT_FULL,         ERROR_DESTINATION_ELEMENT_FULL);
    addCodes(STATUS_ILLEGAL_ELEMENT_ADDRESS,          ERROR_ILLEGAL_ELEMENT_ADDRESS);
    addCodes(STATUS_MAGAZINE_NOT_PRESENT,             ERROR_MAGAZINE_NOT_PRESENT);
    addCodes(STATUS_REINITIALIZATION_NEEDED,          ERROR_DEVICE_REINITIALIZATION_NEEDED);
    addCodes(STATUS_DEVICE_REQUIRES_CLEANING,         ERROR_DEVICE_REQUIRES_CLEANING);
    addCodes(STATUS_DEVICE_DOOR_OPEN,                 ERROR_DEVICE_DOOR_OPEN);
    addCodes(STATUS_TRANSPORT_FULL,                   ERROR_TRANSPORT_FULL);
    addCodes(STATUS_CLEANER_CARTRIDGE_INSTALLED,      ERROR_CLEANER_CARTRIDGE_INSTALLED);
    addCodes(STATUS_REG_NAT_CONSUMPTION,              ERROR_REG_NAT_CONSUMPTION);
    addCodes(STATUS_ENCRYPTION_FAILED,                ERROR_ACCESS_DENIED);
    addCodes(STATUS_DECRYPTION_FAILED,                ERROR_ACCESS_DENIED);
    addCodes(STATUS_NO_RECOVERY_POLICY,               ERROR_ACCESS_DENIED);
    addCodes(STATUS_NO_EFS,                           ERROR_ACCESS_DENIED);
    addCodes(STATUS_WRONG_EFS,                        ERROR_ACCESS_DENIED);
    addCodes(STATUS_NO_USER_KEYS,                     ERROR_ACCESS_DENIED);
    addCodes(STATUS_FILE_NOT_ENCRYPTED,               ERROR_FILE_NOT_ENCRYPTED);
    addCodes(STATUS_NOT_EXPORT_FORMAT,                ERROR_NOT_EXPORT_FORMAT);
    addCodes(STATUS_FILE_ENCRYPTED,                   ERROR_FILE_ENCRYPTED);
    addCodes(STATUS_EFS_ALG_BLOB_TOO_BIG,             ERROR_EFS_ALG_BLOB_TOO_BIG);
    addCodes(STATUS_INVALID_USER_BUFFER,              ERROR_INVALID_USER_BUFFER);
    addCodes(STATUS_SERIAL_NO_DEVICE_INITED,          ERROR_SERIAL_NO_DEVICE);
    addCodes(STATUS_SHARED_IRQ_BUSY,                  ERROR_IRQ_BUSY);
    addCodes(STATUS_SERIAL_MORE_WRITES,               ERROR_MORE_WRITES);
    addCodes(STATUS_SERIAL_COUNTER_TIMEOUT,           ERROR_COUNTER_TIMEOUT);
    addCodes(STATUS_FLOPPY_ID_MARK_NOT_FOUND,         ERROR_FLOPPY_ID_MARK_NOT_FOUND);
    addCodes(STATUS_FLOPPY_WRONG_CYLINDER,            ERROR_FLOPPY_WRONG_CYLINDER);
    addCodes(STATUS_FLOPPY_UNKNOWN_ERROR,             ERROR_FLOPPY_UNKNOWN_ERROR);
    addCodes(STATUS_FLOPPY_BAD_REGISTERS,             ERROR_FLOPPY_BAD_REGISTERS);
    addCodes(STATUS_DISK_RECALIBRATE_FAILED,          ERROR_DISK_RECALIBRATE_FAILED);
    addCodes(STATUS_DISK_OPERATION_FAILED,            ERROR_DISK_OPERATION_FAILED);
    addCodes(STATUS_DISK_RESET_FAILED,                ERROR_DISK_RESET_FAILED);
    addCodes(STATUS_EVENTLOG_FILE_CORRUPT,            ERROR_EVENTLOG_FILE_CORRUPT);
    addCodes(STATUS_EVENTLOG_CANT_START,              ERROR_EVENTLOG_CANT_START);
    addCodes(STATUS_NETLOGON_NOT_STARTED,             ERROR_NETLOGON_NOT_STARTED);
    addCodes(STATUS_ACCOUNT_EXPIRED,                  ERROR_ACCOUNT_EXPIRED);
    addCodes(STATUS_NETWORK_CREDENTIAL_CONFLICT,      ERROR_SESSION_CREDENTIAL_CONFLICT);
    addCodes(STATUS_REMOTE_SESSION_LIMIT,             ERROR_REMOTE_SESSION_LIMIT_EXCEEDED);
    addCodes(STATUS_INVALID_BUFFER_SIZE,              ERROR_INVALID_USER_BUFFER);
    addCodes(STATUS_INVALID_ADDRESS_COMPONENT,        ERROR_INVALID_NETNAME);
    addCodes(STATUS_INVALID_ADDRESS_WILDCARD,         ERROR_INVALID_NETNAME);
    addCodes(STATUS_ADDRESS_ALREADY_EXISTS,           ERROR_DUP_NAME);
    addCodes(STATUS_ADDRESS_CLOSED,                   ERROR_NETNAME_DELETED   );
    addCodes(STATUS_CONNECTION_DISCONNECTED,          ERROR_NETNAME_DELETED   );
    addCodes(STATUS_CONNECTION_RESET,                 ERROR_NETNAME_DELETED   );
    addCodes(STATUS_TRANSACTION_ABORTED,              ERROR_UNEXP_NET_ERR   );
    addCodes(STATUS_TRANSACTION_TIMED_OUT,            ERROR_UNEXP_NET_ERR   );
    addCodes(STATUS_TRANSACTION_NO_RELEASE,           ERROR_UNEXP_NET_ERR   );
    addCodes(STATUS_TRANSACTION_NO_MATCH,             ERROR_UNEXP_NET_ERR   );
    addCodes(STATUS_TRANSACTION_RESPONDED,            ERROR_UNEXP_NET_ERR   );
    addCodes(STATUS_TRANSACTION_INVALID_ID,           ERROR_UNEXP_NET_ERR   );
    addCodes(STATUS_TRANSACTION_INVALID_TYPE,         ERROR_UNEXP_NET_ERR   );
    addCodes(STATUS_NOT_SERVER_SESSION,               ERROR_NOT_SUPPORTED   );
    addCodes(STATUS_NOT_CLIENT_SESSION,               ERROR_NOT_SUPPORTED   );
    addCodes(STATUS_USER_MAPPED_FILE,                 ERROR_USER_MAPPED_FILE   );
    addCodes(STATUS_PLUGPLAY_NO_DEVICE,               ERROR_SERVICE_DISABLED   );
    addCodes(STATUS_WMI_GUID_NOT_FOUND,               ERROR_WMI_GUID_NOT_FOUND   );
    addCodes(STATUS_WMI_INSTANCE_NOT_FOUND,           ERROR_WMI_INSTANCE_NOT_FOUND   );
    addCodes(STATUS_WMI_ITEMID_NOT_FOUND,             ERROR_WMI_ITEMID_NOT_FOUND   );
    addCodes(STATUS_WMI_TRY_AGAIN,                    ERROR_WMI_TRY_AGAIN   );
    addCodes(STATUS_WMI_READ_ONLY,                    ERROR_WMI_READ_ONLY   );
    addCodes(STATUS_WMI_SET_FAILURE,                  ERROR_WMI_SET_FAILURE   );
    addCodes(STATUS_WMI_NOT_SUPPORTED,                ERROR_NOT_SUPPORTED   );
    addCodes(STATUS_WMI_GUID_DISCONNECTED,            ERROR_WMI_GUID_DISCONNECTED   );
    addCodes(STATUS_WMI_ALREADY_DISABLED,             ERROR_WMI_ALREADY_DISABLED   );
    addCodes(STATUS_WMI_ALREADY_ENABLED,              ERROR_WMI_ALREADY_ENABLED   );
    addCodes(STATUS_COPY_PROTECTION_FAILURE,          STG_E_STATUS_COPY_PROTECTION_FAILURE );
    addCodes(STATUS_CSS_AUTHENTICATION_FAILURE,       STG_E_CSS_AUTHENTICATION_FAILURE   );
    addCodes(STATUS_CSS_KEY_NOT_PRESENT,              STG_E_CSS_KEY_NOT_PRESENT   );
    addCodes(STATUS_CSS_KEY_NOT_ESTABLISHED,          STG_E_CSS_KEY_NOT_ESTABLISHED   );
    addCodes(STATUS_CSS_SCRAMBLED_SECTOR,             STG_E_CSS_SCRAMBLED_SECTOR   );
    addCodes(STATUS_CSS_REGION_MISMATCH,              STG_E_CSS_REGION_MISMATCH   );
    addCodes(STATUS_CSS_RESETS_EXHAUSTED,             STG_E_RESETS_EXHAUSTED   );
    addCodes(RPC_NT_SERVER_UNAVAILABLE,               RPC_S_SERVER_UNAVAILABLE   );
    addCodes(RPC_NT_INVALID_STRING_BINDING,           RPC_S_INVALID_STRING_BINDING   );
    addCodes(RPC_NT_WRONG_KIND_OF_BINDING,            RPC_S_WRONG_KIND_OF_BINDING   );
    addCodes(RPC_NT_PROTSEQ_NOT_SUPPORTED,            RPC_S_PROTSEQ_NOT_SUPPORTED   );
    addCodes(RPC_NT_INVALID_RPC_PROTSEQ,              RPC_S_INVALID_RPC_PROTSEQ   );
    addCodes(RPC_NT_INVALID_STRING_UUID,              RPC_S_INVALID_STRING_UUID   );
    addCodes(RPC_NT_INVALID_ENDPOINT_FORMAT,          RPC_S_INVALID_ENDPOINT_FORMAT   );
    addCodes(RPC_NT_INVALID_NET_ADDR,                 RPC_S_INVALID_NET_ADDR   );
    addCodes(RPC_NT_NO_ENDPOINT_FOUND,                RPC_S_NO_ENDPOINT_FOUND   );
    addCodes(RPC_NT_INVALID_TIMEOUT,                  RPC_S_INVALID_TIMEOUT   );
    addCodes(RPC_NT_OBJECT_NOT_FOUND,                 RPC_S_OBJECT_NOT_FOUND   );
    addCodes(RPC_NT_ALREADY_REGISTERED,               RPC_S_ALREADY_REGISTERED   );
    addCodes(RPC_NT_TYPE_ALREADY_REGISTERED,          RPC_S_TYPE_ALREADY_REGISTERED   );
    addCodes(RPC_NT_ALREADY_LISTENING,                RPC_S_ALREADY_LISTENING   );
    addCodes(RPC_NT_NO_PROTSEQS_REGISTERED,           RPC_S_NO_PROTSEQS_REGISTERED   );
    addCodes(RPC_NT_NOT_LISTENING,                    RPC_S_NOT_LISTENING   );
    addCodes(RPC_NT_UNKNOWN_MGR_TYPE,                 RPC_S_UNKNOWN_MGR_TYPE   );
    addCodes(RPC_NT_UNKNOWN_IF,                       RPC_S_UNKNOWN_IF   );
    addCodes(RPC_NT_NO_BINDINGS,                      RPC_S_NO_BINDINGS   );
    addCodes(RPC_NT_NO_MORE_BINDINGS,                 RPC_S_NO_MORE_BINDINGS   );
    addCodes(RPC_NT_NO_PROTSEQS,                      RPC_S_NO_PROTSEQS   );
    addCodes(RPC_NT_CANT_CREATE_ENDPOINT,             RPC_S_CANT_CREATE_ENDPOINT   );
    addCodes(RPC_NT_OUT_OF_RESOURCES,                 RPC_S_OUT_OF_RESOURCES   );
    addCodes(RPC_NT_SERVER_TOO_BUSY,                  RPC_S_SERVER_TOO_BUSY   );
    addCodes(RPC_NT_INVALID_NETWORK_OPTIONS,          RPC_S_INVALID_NETWORK_OPTIONS   );
    addCodes(RPC_NT_NO_CALL_ACTIVE,                   RPC_S_NO_CALL_ACTIVE   );
    addCodes(RPC_NT_CALL_FAILED,                      RPC_S_CALL_FAILED   );
    addCodes(RPC_NT_CALL_FAILED_DNE,                  RPC_S_CALL_FAILED_DNE   );
    addCodes(RPC_NT_PROTOCOL_ERROR,                   RPC_S_PROTOCOL_ERROR   );
    addCodes(RPC_NT_UNSUPPORTED_TRANS_SYN,            RPC_S_UNSUPPORTED_TRANS_SYN   );
    addCodes(RPC_NT_UNSUPPORTED_TYPE,                 RPC_S_UNSUPPORTED_TYPE   );
    addCodes(RPC_NT_INVALID_TAG,                      RPC_S_INVALID_TAG   );
    addCodes(RPC_NT_INVALID_BOUND,                    RPC_S_INVALID_BOUND   );
    addCodes(RPC_NT_NO_ENTRY_NAME,                    RPC_S_NO_ENTRY_NAME   );
    addCodes(RPC_NT_INVALID_NAME_SYNTAX,              RPC_S_INVALID_NAME_SYNTAX   );
    addCodes(RPC_NT_UNSUPPORTED_NAME_SYNTAX,          RPC_S_UNSUPPORTED_NAME_SYNTAX   );
    addCodes(RPC_NT_UUID_NO_ADDRESS,                  RPC_S_UUID_NO_ADDRESS   );
    addCodes(RPC_NT_DUPLICATE_ENDPOINT,               RPC_S_DUPLICATE_ENDPOINT   );
    addCodes(RPC_NT_UNKNOWN_AUTHN_TYPE,               RPC_S_UNKNOWN_AUTHN_TYPE   );
    addCodes(RPC_NT_MAX_CALLS_TOO_SMALL,              RPC_S_MAX_CALLS_TOO_SMALL   );
    addCodes(RPC_NT_STRING_TOO_LONG,                  RPC_S_STRING_TOO_LONG   );
    addCodes(RPC_NT_PROTSEQ_NOT_FOUND,                RPC_S_PROTSEQ_NOT_FOUND   );
    addCodes(RPC_NT_PROCNUM_OUT_OF_RANGE,             RPC_S_PROCNUM_OUT_OF_RANGE   );
    addCodes(RPC_NT_BINDING_HAS_NO_AUTH,              RPC_S_BINDING_HAS_NO_AUTH   );
    addCodes(RPC_NT_UNKNOWN_AUTHN_SERVICE,            RPC_S_UNKNOWN_AUTHN_SERVICE   );
    addCodes(RPC_NT_UNKNOWN_AUTHN_LEVEL,              RPC_S_UNKNOWN_AUTHN_LEVEL   );
    addCodes(RPC_NT_INVALID_AUTH_IDENTITY,            RPC_S_INVALID_AUTH_IDENTITY   );
    addCodes(RPC_NT_UNKNOWN_AUTHZ_SERVICE,            RPC_S_UNKNOWN_AUTHZ_SERVICE   );
    addCodes(EPT_NT_INVALID_ENTRY,                    EPT_S_INVALID_ENTRY   );
    addCodes(EPT_NT_CANT_PERFORM_OP,                  EPT_S_CANT_PERFORM_OP   );
    addCodes(EPT_NT_NOT_REGISTERED,                   EPT_S_NOT_REGISTERED   );
    addCodes(RPC_NT_NOTHING_TO_EXPORT,                RPC_S_NOTHING_TO_EXPORT   );
    addCodes(RPC_NT_INCOMPLETE_NAME,                  RPC_S_INCOMPLETE_NAME   );
    addCodes(RPC_NT_INVALID_VERS_OPTION,              RPC_S_INVALID_VERS_OPTION   );
    addCodes(RPC_NT_NO_MORE_MEMBERS,                  RPC_S_NO_MORE_MEMBERS   );
    addCodes(RPC_NT_NOT_ALL_OBJS_UNEXPORTED,          RPC_S_NOT_ALL_OBJS_UNEXPORTED   );
    addCodes(RPC_NT_INTERFACE_NOT_FOUND,              RPC_S_INTERFACE_NOT_FOUND   );
    addCodes(RPC_NT_ENTRY_ALREADY_EXISTS,             RPC_S_ENTRY_ALREADY_EXISTS   );
    addCodes(RPC_NT_ENTRY_NOT_FOUND,                  RPC_S_ENTRY_NOT_FOUND   );
    addCodes(RPC_NT_NAME_SERVICE_UNAVAILABLE,         RPC_S_NAME_SERVICE_UNAVAILABLE   );
    addCodes(RPC_NT_INVALID_NAF_ID,                   RPC_S_INVALID_NAF_ID   );
    addCodes(RPC_NT_CANNOT_SUPPORT,                   RPC_S_CANNOT_SUPPORT   );
    addCodes(RPC_NT_NO_CONTEXT_AVAILABLE,             RPC_S_NO_CONTEXT_AVAILABLE   );
    addCodes(RPC_NT_INTERNAL_ERROR,                   RPC_S_INTERNAL_ERROR   );
    addCodes(RPC_NT_ZERO_DIVIDE,                      RPC_S_ZERO_DIVIDE   );
    addCodes(RPC_NT_ADDRESS_ERROR,                    RPC_S_ADDRESS_ERROR   );
    addCodes(RPC_NT_FP_DIV_ZERO,                      RPC_S_FP_DIV_ZERO   );
    addCodes(RPC_NT_FP_UNDERFLOW,                     RPC_S_FP_UNDERFLOW   );
    addCodes(RPC_NT_FP_OVERFLOW,                      RPC_S_FP_OVERFLOW   );
    addCodes(RPC_NT_NO_MORE_ENTRIES,                  RPC_X_NO_MORE_ENTRIES   );
    addCodes(RPC_NT_SS_CHAR_TRANS_OPEN_FAIL,          RPC_X_SS_CHAR_TRANS_OPEN_FAIL   );
    addCodes(RPC_NT_SS_CHAR_TRANS_SHORT_FILE,         RPC_X_SS_CHAR_TRANS_SHORT_FILE   );
    addCodes(RPC_NT_SS_CONTEXT_MISMATCH,              ERROR_INVALID_HANDLE   );
    addCodes(RPC_NT_SS_CONTEXT_DAMAGED,               RPC_X_SS_CONTEXT_DAMAGED   );
    addCodes(RPC_NT_SS_HANDLES_MISMATCH,              RPC_X_SS_HANDLES_MISMATCH   );
    addCodes(RPC_NT_SS_CANNOT_GET_CALL_HANDLE,        RPC_X_SS_CANNOT_GET_CALL_HANDLE   );
    addCodes(RPC_NT_NULL_REF_POINTER,                 RPC_X_NULL_REF_POINTER   );
    addCodes(RPC_NT_ENUM_VALUE_OUT_OF_RANGE,          RPC_X_ENUM_VALUE_OUT_OF_RANGE   );
    addCodes(RPC_NT_BYTE_COUNT_TOO_SMALL,             RPC_X_BYTE_COUNT_TOO_SMALL   );
    addCodes(RPC_NT_BAD_STUB_DATA,                    RPC_X_BAD_STUB_DATA   );
    addCodes(RPC_NT_INVALID_OBJECT,                   RPC_S_INVALID_OBJECT   );
    addCodes(STATUS_NO_TRUST_LSA_SECRET,              ERROR_NO_TRUST_LSA_SECRET   );
    addCodes(STATUS_NO_TRUST_SAM_ACCOUNT,             ERROR_NO_TRUST_SAM_ACCOUNT   );
    addCodes(STATUS_TRUSTED_DOMAIN_FAILURE,           ERROR_TRUSTED_DOMAIN_FAILURE   );
    addCodes(STATUS_TRUSTED_RELATIONSHIP_FAILURE,     ERROR_TRUSTED_RELATIONSHIP_FAILURE  );
    addCodes(STATUS_TRUST_FAILURE,                    ERROR_TRUST_FAILURE   );
    addCodes(RPC_NT_CALL_IN_PROGRESS,                 RPC_S_CALL_IN_PROGRESS   );
    addCodes(STATUS_LOG_FILE_FULL,                    ERROR_LOG_FILE_FULL   );
    addCodes(STATUS_EVENTLOG_FILE_CHANGED,            ERROR_EVENTLOG_FILE_CHANGED   );
    addCodes(STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT, ERROR_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT  );
    addCodes(STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT, ERROR_NOLOGON_WORKSTATION_TRUST_ACCOUNT );
    addCodes(STATUS_NOLOGON_SERVER_TRUST_ACCOUNT,     ERROR_NOLOGON_SERVER_TRUST_ACCOUNT  );
    addCodes(STATUS_DOMAIN_TRUST_INCONSISTENT,        ERROR_DOMAIN_TRUST_INCONSISTENT   );
    addCodes(STATUS_NO_USER_SESSION_KEY,              ERROR_NO_USER_SESSION_KEY   );
    addCodes(STATUS_POSSIBLE_DEADLOCK,                ERROR_POSSIBLE_DEADLOCK   );
    addCodes(STATUS_IMAGE_ALREADY_LOADED,             ERROR_SERVICE_ALREADY_RUNNING   );
    addCodes(RPC_NT_GROUP_MEMBER_NOT_FOUND,           RPC_S_GROUP_MEMBER_NOT_FOUND   );
    addCodes(RPC_NT_NO_INTERFACES,                    RPC_S_NO_INTERFACES   );
    addCodes(RPC_NT_CALL_CANCELLED,                   RPC_S_CALL_CANCELLED   );
    addCodes(RPC_NT_BINDING_INCOMPLETE,               RPC_S_BINDING_INCOMPLETE   );
    addCodes(RPC_NT_COMM_FAILURE,                     RPC_S_COMM_FAILURE   );
    addCodes(RPC_NT_UNSUPPORTED_AUTHN_LEVEL,          RPC_S_UNSUPPORTED_AUTHN_LEVEL   );
    addCodes(RPC_NT_NO_PRINC_NAME,                    RPC_S_NO_PRINC_NAME   );
    addCodes(RPC_NT_NOT_RPC_ERROR,                    RPC_S_NOT_RPC_ERROR   );
    addCodes(RPC_NT_UUID_LOCAL_ONLY,                  RPC_S_UUID_LOCAL_ONLY   );
    addCodes(RPC_NT_SEC_PKG_ERROR,                    RPC_S_SEC_PKG_ERROR   );
    addCodes(RPC_NT_NOT_CANCELLED,                    RPC_S_NOT_CANCELLED   );
    addCodes(RPC_NT_INVALID_ES_ACTION,                RPC_X_INVALID_ES_ACTION   );
    addCodes(RPC_NT_WRONG_ES_VERSION,                 RPC_X_WRONG_ES_VERSION   );
    addCodes(RPC_NT_WRONG_STUB_VERSION,               RPC_X_WRONG_STUB_VERSION   );
    addCodes(RPC_NT_INVALID_PIPE_OBJECT,              RPC_X_INVALID_PIPE_OBJECT   );
    addCodes(RPC_NT_INVALID_PIPE_OPERATION,           RPC_X_INVALID_PIPE_OPERATION   );
    addCodes(RPC_NT_WRONG_PIPE_VERSION,               RPC_X_WRONG_PIPE_VERSION   );
    addCodes(EPT_NT_CANT_CREATE,                      EPT_S_CANT_CREATE   );
    addCodes(RPC_NT_SEND_INCOMPLETE,                  RPC_S_SEND_INCOMPLETE   );
    addCodes(RPC_NT_INVALID_ASYNC_HANDLE,             RPC_S_INVALID_ASYNC_HANDLE   );
    addCodes(RPC_NT_INVALID_ASYNC_CALL,               RPC_S_INVALID_ASYNC_CALL   );
    addCodes(RPC_NT_PIPE_CLOSED,                      RPC_X_PIPE_CLOSED   );
    addCodes(RPC_NT_PIPE_EMPTY,                       RPC_X_PIPE_EMPTY   );
    addCodes(RPC_NT_PIPE_DISCIPLINE_ERROR,            RPC_X_PIPE_DISCIPLINE_ERROR   );
    addCodes(STATUS_NO_BROWSER_SERVERS_FOUND,         ERROR_NO_BROWSER_SERVERS_FOUND   );
    addCodes(STATUS_MAPPED_ALIGNMENT,                 ERROR_MAPPED_ALIGNMENT   );
    addCodes(STATUS_CONNECTION_IN_USE,                ERROR_DEVICE_IN_USE   );
    addCodes(STATUS_VERIFY_REQUIRED,                  ERROR_MEDIA_CHANGED   );
    addCodes(STATUS_ALREADY_DISCONNECTED,             ERROR_ACTIVE_CONNECTIONS   );
    addCodes(STATUS_CONNECTION_REFUSED,               ERROR_CONNECTION_REFUSED   );
    addCodes(STATUS_GRACEFUL_DISCONNECT,              ERROR_GRACEFUL_DISCONNECT   );
    addCodes(STATUS_ADDRESS_ALREADY_ASSOCIATED,       ERROR_ADDRESS_ALREADY_ASSOCIATED   );
    addCodes(STATUS_ADDRESS_NOT_ASSOCIATED,           ERROR_ADDRESS_NOT_ASSOCIATED   );
    addCodes(STATUS_CONNECTION_INVALID,               ERROR_CONNECTION_INVALID   );
    addCodes(STATUS_CONNECTION_ACTIVE,                ERROR_CONNECTION_ACTIVE   );
    addCodes(STATUS_NETWORK_UNREACHABLE,              ERROR_NETWORK_UNREACHABLE   );
    addCodes(STATUS_HOST_UNREACHABLE,                 ERROR_HOST_UNREACHABLE   );
    addCodes(STATUS_HOST_DOWN,                        ERROR_HOST_DOWN   );
    addCodes(STATUS_PROTOCOL_UNREACHABLE,             ERROR_PROTOCOL_UNREACHABLE   );
    addCodes(STATUS_PORT_UNREACHABLE,                 ERROR_PORT_UNREACHABLE   );
    addCodes(STATUS_REQUEST_ABORTED,                  ERROR_REQUEST_ABORTED   );
    addCodes(STATUS_CONNECTION_ABORTED,               ERROR_CONNECTION_ABORTED   );
    addCodes(STATUS_CONNECTION_COUNT_LIMIT,           ERROR_CONNECTION_COUNT_LIMIT   );
    addCodes(STATUS_PATH_NOT_COVERED,                 ERROR_HOST_UNREACHABLE   );
    addCodes(STATUS_LOGIN_TIME_RESTRICTION,           ERROR_LOGIN_TIME_RESTRICTION   );
    addCodes(STATUS_LOGIN_WKSTA_RESTRICTION,          ERROR_LOGIN_WKSTA_RESTRICTION   );
    addCodes(STATUS_LICENSE_QUOTA_EXCEEDED,           ERROR_LICENSE_QUOTA_EXCEEDED   );
    addCodes(STATUS_RESOURCE_NOT_OWNED,               ERROR_NOT_OWNER   );
    addCodes(STATUS_DUPLICATE_OBJECTID,               STATUS_DUPLICATE_OBJECTID   );
    addCodes(STATUS_OBJECTID_EXISTS,                  STATUS_OBJECTID_EXISTS   );
    addCodes(STATUS_MFT_TOO_FRAGMENTED,               ERROR_DISK_TOO_FRAGMENTED   );
    addCodes(SEC_E_INSUFFICIENT_MEMORY,               ERROR_NO_SYSTEM_RESOURCES   );
    addCodes(SEC_E_INVALID_HANDLE,                    ERROR_INVALID_HANDLE   );
    addCodes(SEC_E_UNSUPPORTED_FUNCTION,              ERROR_INVALID_FUNCTION   );
    addCodes(SEC_E_TARGET_UNKNOWN,                    ERROR_BAD_NETPATH   );
    addCodes(SEC_E_INTERNAL_ERROR,                    ERROR_INTERNAL_ERROR   );
    addCodes(SEC_E_SECPKG_NOT_FOUND,                  ERROR_NO_SUCH_PACKAGE   );
    addCodes(SEC_E_NOT_OWNER,                         ERROR_NOT_OWNER   );
    addCodes(SEC_E_CANNOT_INSTALL,                    ERROR_NO_SUCH_PACKAGE   );
    addCodes(SEC_E_QOP_NOT_SUPPORTED,                 ERROR_NOT_SUPPORTED   );
    addCodes(SEC_E_NO_IMPERSONATION,                  ERROR_CANNOT_IMPERSONATE   );
    addCodes(SEC_E_MULTIPLE_ACCOUNTS,                 ERROR_CANNOT_IMPERSONATE   );
    addCodes(SEC_E_LOGON_DENIED,                      ERROR_LOGON_FAILURE   );
    addCodes(SEC_E_NO_CREDENTIALS,                    ERROR_NO_SUCH_LOGON_SESSION   );
    addCodes(SEC_E_MESSAGE_ALTERED,                   ERROR_ACCESS_DENIED   );
    addCodes(SEC_E_OUT_OF_SEQUENCE,                   ERROR_ACCESS_DENIED   );
    addCodes(SEC_E_NO_AUTHENTICATING_AUTHORITY,       ERROR_NO_LOGON_SERVERS   );
    addCodes(SEC_E_BAD_PKGID,                         ERROR_NO_SUCH_PACKAGE   );
    addCodes(SEC_E_WRONG_PRINCIPAL,                   ERROR_WRONG_TARGET_NAME   );
    addCodes(SEC_E_INCOMPLETE_MESSAGE,                ERROR_INVALID_USER_BUFFER   );
    addCodes(SEC_E_BUFFER_TOO_SMALL,                  ERROR_INSUFFICIENT_BUFFER   );
    addCodes(SEC_E_UNTRUSTED_ROOT,                    ERROR_TRUST_FAILURE   );
    addCodes(SEC_E_CERT_EXPIRED,                      ERROR_PASSWORD_EXPIRED   );
    addCodes(SEC_E_ENCRYPT_FAILURE,                   ERROR_ENCRYPTION_FAILED   );
    addCodes(SEC_E_DECRYPT_FAILURE,                   ERROR_DECRYPTION_FAILED   );
    addCodes(SEC_E_ALGORITHM_MISMATCH,                ERROR_INVALID_FUNCTION   );
    addCodes(SEC_E_CONTEXT_EXPIRED,                   ERROR_CONTEXT_EXPIRED   );
    addCodes(STATUS_BAD_BINDINGS,                     SEC_E_BAD_BINDINGS   );
    addCodes(TRUST_E_CERT_SIGNATURE,                  ERROR_MUTUAL_AUTH_FAILED   );
    addCodes(CRYPT_E_REVOKED,                         ERROR_MUTUAL_AUTH_FAILED   );
    addCodes(CRYPT_E_NO_REVOCATION_CHECK,             ERROR_MUTUAL_AUTH_FAILED   );
    addCodes(CRYPT_E_REVOCATION_OFFLINE,              ERROR_MUTUAL_AUTH_FAILED   );
    addCodes(STATUS_SHUTDOWN_IN_PROGRESS,             ERROR_SHUTDOWN_IN_PROGRESS   );
    addCodes(STATUS_SERVER_SHUTDOWN_IN_PROGRESS,      ERROR_SERVER_SHUTDOWN_IN_PROGRESS   );
    addCodes(STATUS_DS_MEMBERSHIP_EVALUATED_LOCALLY,  ERROR_DS_MEMBERSHIP_EVALUATED_LOCALLY);
    addCodes(STATUS_DS_NO_ATTRIBUTE_OR_VALUE,         ERROR_DS_NO_ATTRIBUTE_OR_VALUE   );
    addCodes(STATUS_DS_INVALID_ATTRIBUTE_SYNTAX,      ERROR_DS_INVALID_ATTRIBUTE_SYNTAX   );
    addCodes(STATUS_DS_ATTRIBUTE_TYPE_UNDEFINED,      ERROR_DS_ATTRIBUTE_TYPE_UNDEFINED   );
    addCodes(STATUS_DS_ATTRIBUTE_OR_VALUE_EXISTS,     ERROR_DS_ATTRIBUTE_OR_VALUE_EXISTS  );
    addCodes(STATUS_DS_BUSY,                          ERROR_DS_BUSY   );
    addCodes(STATUS_DS_UNAVAILABLE,                   ERROR_DS_UNAVAILABLE   );
    addCodes(STATUS_DS_NO_RIDS_ALLOCATED,             ERROR_DS_NO_RIDS_ALLOCATED   );
    addCodes(STATUS_DS_NO_MORE_RIDS,                  ERROR_DS_NO_MORE_RIDS   );
    addCodes(STATUS_DS_INCORRECT_ROLE_OWNER,          ERROR_DS_INCORRECT_ROLE_OWNER   );
    addCodes(STATUS_DS_RIDMGR_INIT_ERROR,             ERROR_DS_RIDMGR_INIT_ERROR   );
    addCodes(STATUS_DS_OBJ_CLASS_VIOLATION,           ERROR_DS_OBJ_CLASS_VIOLATION   );
    addCodes(STATUS_DS_CANT_ON_NON_LEAF,              ERROR_DS_CANT_ON_NON_LEAF   );
    addCodes(STATUS_DS_CANT_ON_RDN,                   ERROR_DS_CANT_ON_RDN   );
    addCodes(STATUS_DS_CROSS_DOM_MOVE_FAILED,         ERROR_DS_CROSS_DOM_MOVE_ERROR   );
    addCodes(STATUS_DS_GC_NOT_AVAILABLE,              ERROR_DS_GC_NOT_AVAILABLE   );
    addCodes(STATUS_DS_CANT_MOD_OBJ_CLASS,            ERROR_DS_CANT_MOD_OBJ_CLASS   );
    addCodes(STATUS_DS_ADMIN_LIMIT_EXCEEDED,          ERROR_DS_ADMIN_LIMIT_EXCEEDED   );
    addCodes(STATUS_DIRECTORY_SERVICE_REQUIRED,       ERROR_DS_DS_REQUIRED   );
    addCodes(STATUS_DS_SAM_INIT_FAILURE,              ERROR_DS_SAM_INIT_FAILURE   );
    addCodes(STATUS_DS_CANT_START,                    ERROR_DS_CANT_START   );
    addCodes(STATUS_DS_INIT_FAILURE,                  ERROR_DS_INIT_FAILURE   );
    addCodes(STATUS_SAM_INIT_FAILURE,                 ERROR_SAM_INIT_FAILURE   );
    addCodes(STATUS_DS_SENSITIVE_GROUP_VIOLATION,     ERROR_DS_SENSITIVE_GROUP_VIOLATION  );
    addCodes(STATUS_DS_CANT_MOD_PRIMARYGROUPID,       ERROR_DS_CANT_MOD_PRIMARYGROUPID   );
    addCodes(STATUS_DS_INVALID_GROUP_TYPE,            ERROR_DS_INVALID_GROUP_TYPE   );
    addCodes(STATUS_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN
      , ERROR_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN);
    addCodes(STATUS_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN
      , ERROR_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN);
    addCodes(STATUS_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER
      , ERROR_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER);
    addCodes(STATUS_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER
      , ERROR_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER);
    addCodes(STATUS_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER
      , ERROR_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER);
    addCodes(STATUS_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER
      , ERROR_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER);
    addCodes(STATUS_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER
      , ERROR_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER);
    addCodes(STATUS_DS_HAVE_PRIMARY_MEMBERS,          ERROR_DS_HAVE_PRIMARY_MEMBERS   );
    addCodes(STATUS_DS_GC_REQUIRED,                   ERROR_DS_GC_REQUIRED   );
    addCodes(STATUS_DS_LOCAL_MEMBER_OF_LOCAL_ONLY,    ERROR_DS_LOCAL_MEMBER_OF_LOCAL_ONLY );
    addCodes(STATUS_DS_NO_FPO_IN_UNIVERSAL_GROUPS,    ERROR_DS_NO_FPO_IN_UNIVERSAL_GROUPS );
    addCodes(STATUS_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED, ERROR_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED   );
    addCodes(STATUS_SAM_NEED_BOOTKEY_PASSWORD,        ERROR_DS_SAM_NEED_BOOTKEY_PASSWORD  );
    addCodes(STATUS_SAM_NEED_BOOTKEY_FLOPPY,          ERROR_DS_SAM_NEED_BOOTKEY_FLOPPY   );
    addCodes(STATUS_DS_INIT_FAILURE_CONSOLE,          ERROR_DS_INIT_FAILURE_CONSOLE   );
    addCodes(STATUS_DS_SAM_INIT_FAILURE_CONSOLE,      ERROR_DS_SAM_INIT_FAILURE_CONSOLE   );
    addCodes(STATUS_UNFINISHED_CONTEXT_DELETED,       SEC_E_UNFINISHED_CONTEXT_DELETED   );
    addCodes(STATUS_NO_TGT_REPLY,                     SEC_E_NO_TGT_REPLY   );
    addCodes(STATUS_NO_IP_ADDRESSES,                  SEC_E_NO_IP_ADDRESSES   );
    addCodes(STATUS_WRONG_CREDENTIAL_HANDLE,          SEC_E_WRONG_CREDENTIAL_HANDLE);
    addCodes(STATUS_CRYPTO_SYSTEM_INVALID,            SEC_E_CRYPTO_SYSTEM_INVALID   );
    addCodes(STATUS_MAX_REFERRALS_EXCEEDED,           SEC_E_MAX_REFERRALS_EXCEEDED   );
    addCodes(STATUS_MUST_BE_KDC,                      SEC_E_MUST_BE_KDC   );
    addCodes(STATUS_STRONG_CRYPTO_NOT_SUPPORTED,      SEC_E_STRONG_CRYPTO_NOT_SUPPORTED   );
    addCodes(STATUS_TOO_MANY_PRINCIPALS,              SEC_E_TOO_MANY_PRINCIPALS   );
    addCodes(STATUS_NO_PA_DATA,                       SEC_E_NO_PA_DATA   );
    addCodes(STATUS_PKINIT_NAME_MISMATCH,             SEC_E_PKINIT_NAME_MISMATCH   );
    addCodes(STATUS_SMARTCARD_LOGON_REQUIRED,         SEC_E_SMARTCARD_LOGON_REQUIRED   );
    addCodes(STATUS_KDC_INVALID_REQUEST,              SEC_E_KDC_INVALID_REQUEST   );
    addCodes(STATUS_KDC_UNABLE_TO_REFER,              SEC_E_KDC_UNABLE_TO_REFER   );
    addCodes(STATUS_KDC_UNKNOWN_ETYPE,                SEC_E_KDC_UNKNOWN_ETYPE   );
    addCodes(STATUS_UNSUPPORTED_PREAUTH,              SEC_E_UNSUPPORTED_PREAUTH   );
    addCodes(STATUS_SHARED_POLICY,                    ERROR_SHARED_POLICY   );
    addCodes(STATUS_POLICY_OBJECT_NOT_FOUND,          ERROR_POLICY_OBJECT_NOT_FOUND   );
    addCodes(STATUS_POLICY_ONLY_IN_DS,                ERROR_POLICY_ONLY_IN_DS   );
    addCodes(STATUS_DEVICE_REMOVED,                   ERROR_DEVICE_REMOVED   );
    addCodes(STATUS_RETRY,                            ERROR_RETRY   );
    addCodes(STATUS_NOT_SUPPORTED_ON_SBS,             ERROR_NOT_SUPPORTED_ON_SBS   );
    addCodes(STATUS_DRIVER_BLOCKED_CRITICAL,          ERROR_DRIVER_BLOCKED   );
    addCodes(STATUS_DRIVER_BLOCKED,                   ERROR_DRIVER_BLOCKED   );
    addCodes(STATUS_PRENT4_MACHINE_ACCOUNT,           ERROR_DS_MACHINE_ACCOUNT_CREATED_PRENT4   );
    addCodes(STATUS_DS_AG_CANT_HAVE_UNIVERSAL_MEMBER, ERROR_DS_AG_CANT_HAVE_UNIVERSAL_MEMBER   );
    addCodes(STATUS_DS_SHUTTING_DOWN,                 ERROR_DS_SHUTTING_DOWN   );
    addCodes(STATUS_ACCESS_DISABLED_BY_POLICY_DEFAULT, ERROR_ACCESS_DISABLED_BY_POLICY   );
    addCodes(STATUS_ACCESS_DISABLED_BY_POLICY_PATH,   ERROR_ACCESS_DISABLED_BY_POLICY   );
    addCodes(STATUS_ACCESS_DISABLED_BY_POLICY_PUBLISHER,   ERROR_ACCESS_DISABLED_BY_POLICY   );
    addCodes(STATUS_ACCESS_DISABLED_BY_POLICY_OTHER,  ERROR_ACCESS_DISABLED_BY_POLICY   );
    addCodes(STATUS_CTX_CLOSE_PENDING,                ERROR_CTX_CLOSE_PENDING   );
    addCodes(STATUS_CTX_NO_OUTBUF,                    ERROR_CTX_NO_OUTBUF   );
    addCodes(STATUS_CTX_MODEM_INF_NOT_FOUND,          ERROR_CTX_MODEM_INF_NOT_FOUND   );
    addCodes(STATUS_CTX_INVALID_MODEMNAME,            ERROR_CTX_INVALID_MODEMNAME   );
    addCodes(STATUS_CTX_RESPONSE_ERROR,               ERROR_CTX_MODEM_RESPONSE_ERROR   );
    addCodes(STATUS_CTX_MODEM_RESPONSE_TIMEOUT,       ERROR_CTX_MODEM_RESPONSE_TIMEOUT   );
    addCodes(STATUS_CTX_MODEM_RESPONSE_NO_CARRIER,    ERROR_CTX_MODEM_RESPONSE_NO_CARRIER );
    addCodes(STATUS_CTX_MODEM_RESPONSE_NO_DIALTONE,   ERROR_CTX_MODEM_RESPONSE_NO_DIALTONE   );
    addCodes(STATUS_CTX_MODEM_RESPONSE_BUSY,          ERROR_CTX_MODEM_RESPONSE_BUSY   );
    addCodes(STATUS_CTX_MODEM_RESPONSE_VOICE,         ERROR_CTX_MODEM_RESPONSE_VOICE   );
    addCodes(STATUS_CTX_TD_ERROR,                     ERROR_CTX_TD_ERROR   );
    addCodes(STATUS_LPC_REPLY_LOST,                   ERROR_CONNECTION_ABORTED   );
    addCodes(STATUS_CTX_WINSTATION_NAME_INVALID,      ERROR_CTX_WINSTATION_NAME_INVALID   );
    addCodes(STATUS_CTX_WINSTATION_NOT_FOUND,         ERROR_CTX_WINSTATION_NOT_FOUND   );
    addCodes(STATUS_CTX_WINSTATION_NAME_COLLISION,    ERROR_CTX_WINSTATION_ALREADY_EXISTS );
    addCodes(STATUS_CTX_WINSTATION_BUSY,              ERROR_CTX_WINSTATION_BUSY   );
    addCodes(STATUS_CTX_GRAPHICS_INVALID,             ERROR_CTX_GRAPHICS_INVALID   );
    addCodes(STATUS_CTX_BAD_VIDEO_MODE,               ERROR_CTX_BAD_VIDEO_MODE   );
    addCodes(STATUS_CTX_NOT_CONSOLE,                  ERROR_CTX_NOT_CONSOLE   );
    addCodes(STATUS_CTX_CLIENT_QUERY_TIMEOUT,         ERROR_CTX_CLIENT_QUERY_TIMEOUT   );
    addCodes(STATUS_CTX_CONSOLE_DISCONNECT,           ERROR_CTX_CONSOLE_DISCONNECT   );
    addCodes(STATUS_CTX_CONSOLE_CONNECT,              ERROR_CTX_CONSOLE_CONNECT   );
    addCodes(STATUS_CTX_SHADOW_DENIED,                ERROR_CTX_SHADOW_DENIED   );
    addCodes(STATUS_CTX_SHADOW_INVALID,               ERROR_CTX_SHADOW_INVALID   );
    addCodes(STATUS_CTX_SHADOW_DISABLED,              ERROR_CTX_SHADOW_DISABLED   );
    addCodes(STATUS_CTX_WINSTATION_ACCESS_DENIED,     ERROR_CTX_WINSTATION_ACCESS_DENIED  );
    addCodes(STATUS_CTX_INVALID_PD,                   ERROR_CTX_INVALID_PD   );
    addCodes(STATUS_CTX_PD_NOT_FOUND,                 ERROR_CTX_PD_NOT_FOUND   );
    addCodes(STATUS_CTX_INVALID_WD,                   ERROR_CTX_INVALID_WD   );
    addCodes(STATUS_CTX_WD_NOT_FOUND,                 ERROR_CTX_WD_NOT_FOUND   );
    addCodes(STATUS_CTX_CLIENT_LICENSE_IN_USE,        ERROR_CTX_CLIENT_LICENSE_IN_USE   );
    addCodes(STATUS_CTX_CLIENT_LICENSE_NOT_SET,       ERROR_CTX_CLIENT_LICENSE_NOT_SET   );
    addCodes(STATUS_CTX_LICENSE_NOT_AVAILABLE,        ERROR_CTX_LICENSE_NOT_AVAILABLE   );
    addCodes(STATUS_CTX_LICENSE_CLIENT_INVALID,       ERROR_CTX_LICENSE_CLIENT_INVALID   );
    addCodes(STATUS_CTX_LICENSE_EXPIRED,              ERROR_CTX_LICENSE_EXPIRED   );
    addCodes(STATUS_CTX_SHADOW_ENDED_BY_MODE_CHANGE,  ERROR_CTX_SHADOW_ENDED_BY_MODE_CHANGE   );
    addCodes(STATUS_CTX_SHADOW_NOT_RUNNING,           ERROR_CTX_SHADOW_NOT_RUNNING   );
    addCodes(STATUS_LICENSE_VIOLATION,                ERROR_CTX_LICENSE_NOT_AVAILABLE   );
    addCodes(STATUS_ENDPOINT_CLOSED,                  ERROR_DEV_NOT_EXIST   );
    addCodes(STATUS_DISCONNECTED,                     ERROR_DEV_NOT_EXIST   );
    addCodes(STATUS_NONEXISTENT_NET_NAME,             ERROR_DEV_NOT_EXIST   );
    addCodes(STATUS_NETWORK_SESSION_EXPIRED,          ERROR_NO_USER_SESSION_KEY   );
    addCodes(STATUS_FILES_OPEN,                       ERROR_OPEN_FILES   );
    addCodes(STATUS_SXS_SECTION_NOT_FOUND,            ERROR_SXS_SECTION_NOT_FOUND   );
    addCodes(STATUS_SXS_CANT_GEN_ACTCTX,              ERROR_SXS_CANT_GEN_ACTCTX   );
    addCodes(STATUS_SXS_INVALID_ACTCTXDATA_FORMAT,    ERROR_SXS_INVALID_ACTCTXDATA_FORMAT );
    addCodes(STATUS_SXS_ASSEMBLY_NOT_FOUND,           ERROR_SXS_ASSEMBLY_NOT_FOUND   );
    addCodes(STATUS_SXS_MANIFEST_FORMAT_ERROR,        ERROR_SXS_MANIFEST_FORMAT_ERROR   );
    addCodes(STATUS_SXS_MANIFEST_PARSE_ERROR,         ERROR_SXS_MANIFEST_PARSE_ERROR);
    addCodes(STATUS_SXS_ACTIVATION_CONTEXT_DISABLED,  ERROR_SXS_ACTIVATION_CONTEXT_DISABLED   );
    addCodes(STATUS_SXS_KEY_NOT_FOUND,                ERROR_SXS_KEY_NOT_FOUND   );
    addCodes(STATUS_SXS_WRONG_SECTION_TYPE,           ERROR_SXS_WRONG_SECTION_TYPE   );
    addCodes(STATUS_SXS_THREAD_QUERIES_DISABLED,      ERROR_SXS_THREAD_QUERIES_DISABLED   );
    addCodes(STATUS_SXS_PROCESS_DEFAULT_ALREADY_SET,  ERROR_SXS_PROCESS_DEFAULT_ALREADY_SET   );
    addCodes(STATUS_REDIRECTOR_STARTED,               ERROR_SERVICE_ALREADY_RUNNING   );
    addCodes(STATUS_AUDITING_DISABLED,                ERROR_AUDITING_DISABLED   );
    addCodes(STATUS_CLUSTER_NODE_ALREADY_UP,          ERROR_CLUSTER_NODE_ALREADY_UP   );
    addCodes(STATUS_CLUSTER_NODE_ALREADY_DOWN,        ERROR_CLUSTER_NODE_ALREADY_DOWN   );
    addCodes(STATUS_CLUSTER_NETWORK_ALREADY_ONLINE,   ERROR_CLUSTER_NETWORK_ALREADY_ONLINE   );
    addCodes(STATUS_CLUSTER_NETWORK_ALREADY_OFFLINE,  ERROR_CLUSTER_NETWORK_ALREADY_OFFLINE   );
    addCodes(STATUS_CLUSTER_NODE_ALREADY_MEMBER,      ERROR_CLUSTER_NODE_ALREADY_MEMBER);
    addCodes(STATUS_CLUSTER_INVALID_NODE,             ERROR_CLUSTER_INVALID_NODE   );
    addCodes(STATUS_CLUSTER_NODE_EXISTS,              ERROR_CLUSTER_NODE_EXISTS   );
    addCodes(STATUS_CLUSTER_JOIN_IN_PROGRESS,         ERROR_CLUSTER_JOIN_IN_PROGRESS   );
    addCodes(STATUS_CLUSTER_NODE_NOT_FOUND,           ERROR_CLUSTER_NODE_NOT_FOUND   );
    addCodes(STATUS_CLUSTER_LOCAL_NODE_NOT_FOUND,     ERROR_CLUSTER_LOCAL_NODE_NOT_FOUND  );
    addCodes(STATUS_CLUSTER_NETWORK_EXISTS,           ERROR_CLUSTER_NETWORK_EXISTS   );
    addCodes(STATUS_CLUSTER_NETWORK_NOT_FOUND,        ERROR_CLUSTER_NETWORK_NOT_FOUND   );
    addCodes(STATUS_CLUSTER_NETINTERFACE_EXISTS,      ERROR_CLUSTER_NETINTERFACE_EXISTS   );
    addCodes(STATUS_CLUSTER_NETINTERFACE_NOT_FOUND,   ERROR_CLUSTER_NETINTERFACE_NOT_FOUND   );
    addCodes(STATUS_CLUSTER_INVALID_REQUEST,           ERROR_CLUSTER_INVALID_REQUEST   );
    addCodes(STATUS_CLUSTER_INVALID_NETWORK_PROVIDER, ERROR_CLUSTER_INVALID_NETWORK_PROVIDER   );
    addCodes(STATUS_CLUSTER_NODE_DOWN,                ERROR_CLUSTER_NODE_DOWN   );
    addCodes(STATUS_CLUSTER_NODE_UNREACHABLE,         ERROR_CLUSTER_NODE_UNREACHABLE   );
    addCodes(STATUS_CLUSTER_NODE_NOT_MEMBER,          ERROR_CLUSTER_NODE_NOT_MEMBER   );
    addCodes(STATUS_CLUSTER_JOIN_NOT_IN_PROGRESS,     ERROR_CLUSTER_JOIN_NOT_IN_PROGRESS  );
    addCodes(STATUS_CLUSTER_INVALID_NETWORK,          ERROR_CLUSTER_INVALID_NETWORK   );
    addCodes(STATUS_CLUSTER_NODE_UP,                  ERROR_CLUSTER_NODE_UP   );
    addCodes(STATUS_CLUSTER_NODE_PAUSED,              ERROR_CLUSTER_NODE_PAUSED   );
    addCodes(STATUS_CLUSTER_NODE_NOT_PAUSED,          ERROR_CLUSTER_NODE_NOT_PAUSED   );
    addCodes(STATUS_CLUSTER_NO_SECURITY_CONTEXT,      ERROR_CLUSTER_NO_SECURITY_CONTEXT   );
    addCodes(STATUS_CLUSTER_NETWORK_NOT_INTERNAL,     ERROR_CLUSTER_NETWORK_NOT_INTERNAL );
  }
}

cWinErrorCodes::~cWinErrorCodes(void)
{
}

std::vector<int> cWinErrorCodes::getWinNTCodes(const int Win32Code) const
{
  std::vector<int> ret;

  tErrCodeMultiMap::const_iterator finder = m_32toNTMap.find(Win32Code);

  if (finder != m_32toNTMap.end())
  {
    size_t count = m_32toNTMap.count(Win32Code);
    while (count > 0)
    {
      ret.push_back(finder->second);
      ++finder;
      count--;
    }
  }

  return ret;
}

int cWinErrorCodes::getWin32Code(const int WinNTCode) const
{
  tErrCodeMap::const_iterator finder = m_NTto32Map.find(WinNTCode);

  return (finder != m_NTto32Map.end()) ? finder->second : 0;
}

void cWinErrorCodes::addCodes(const int WinNTErrCode, const int Win32ErrCode)
{
  m_32toNTMap.insert(tErrCodeMultiMap::value_type(Win32ErrCode, WinNTErrCode));
  m_NTto32Map.insert(tErrCodeMap::value_type(WinNTErrCode, Win32ErrCode));
}
